package com.yvon.boot.jwt.config;


import com.yvon.boot.jwt.properties.JwtProperties;
import com.yvon.boot.jwt.utils.TokenUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 认证服务端配置
 *
 * @author : Yvon
 * @since : 2021-09-02
 */
@EnableConfigurationProperties(value = {JwtProperties.class,})
@Slf4j
@Configuration
public class JwtConfig {

    @Bean
    @ConditionalOnMissingBean(TokenUtil.class)
    public TokenUtil tokenUtil(JwtProperties authServerProperties) {
        log.info("token工具注入成功...");
        return new TokenUtil(authServerProperties);
    }
}
